package com.hlw.hr_man.serviceImpl;

import java.util.List;

import com.hlw.hr_man.Model.DeptModel;
import com.hlw.hr_man.dao.FindDeptDao;
import com.hlw.hr_man.daoImpl.FindDeptDaoImpl;
import com.hlw.hr_man.service.FindDeptService;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

public class FindDeptServiceImpl implements FindDeptService{
	FindDeptDao fdd = new FindDeptDaoImpl();

	@Override
	public JSONObject findAllDept(int start, int pageSize) {
		JSONObject   dp = new JSONObject();
		dp.put("total", fdd.getAllDepts());
		dp.put("rows", JSONArray.fromObject(fdd.getDepts(start, pageSize)));
		return dp;
	}

	@Override
	public JSONObject findDepts(int start, int pageSize, String searchname) {
		JSONObject dp = new JSONObject();
		dp.put("total",fdd.getDepts(start, pageSize, searchname));
		dp.put("rows", JSONArray.fromObject(fdd.getDepts(start, pageSize, searchname)));
		
		return dp;
	}

	@Override
	public String findDeptNameByEnumber(String enumber) {
		// TODO Auto-generated method stub
		return fdd.findDeptNameByEnumber(enumber);
	}
    
	/**
	 * 得到部门对象
	 */
	@Override
	public List<DeptModel> getDeptments() {
		// TODO Auto-generated method stub
		return fdd.getDeptments();
	}
	

}
